package cccc;

public class Cell {
    //成员变量(特征) - 位置(x,y)
    int row;//*所在行
    int col;//*所在列

    public Cell() {
    }
    //有参构造方法(确定*所在的位置)
    public Cell(int row, int col) {
        this.row = row;
        this.col = col;
    }

    //成员方法(下移,左移,右移,画*)
    /*public void printCell(int totalCol, int totalRow){
        //确定棋盘的行和列
    }*/
    public void printCell(){
        //确定棋盘的行和列
        int totalCol = 10;
        int totalRow = 20;
        for (int col = 0; col < totalCol; col++) {
            for (int row = 0; row < totalRow; row++) {
                //判断当前棋盘中的位置和传进来的*位置是否相等
                if(this.col == col && this.row == row){
                    System.out.print("*");
                }else {
                    System.out.print("-");
                }
            }
            System.out.println(" ");
        }
    }
    public void printO(){
        int totalCol = 10;
        int totalRoW = 20;
        for (int col = 0;col < totalCol;col++){
            for(int row = 0;row < totalRoW;row++){
                if(this.col == col && this.row ==row ){
                    System.out.print("*");
                }else if(this.col == col-1 && this.row == row-1){
                    System.out.print("*");
                }else if(this.col == col && this.row == row-1){
                    System.out.print("*");
                }else if(this.col == col-1 && this.row == row){
                    System.out.print("*");
                }else{
                    System.out.print("-");
                }
            }
            System.out.println(" ");
        }
    }
    public void printT(){
        int totalCol = 10;
        int totalRoW = 20;
        for (int col = 0;col < totalCol;col++){
            for(int row = 0;row < totalRoW;row++){
                if(this.col == col && this.row ==row ){
                    System.out.print("*");
                }else if(this.col == col && this.row == row-1){
                    System.out.print("*");
                }else if(this.col == col-1 && this.row == row){
                    System.out.print("*");
                }else if(this.col == col+1 && this.row == row){
                    System.out.print("*");
                }else{
                    System.out.print("-");
                }
            }
            System.out.println(" ");
        }
    }


}
